<html>
<head>
<title>fsync</title>
<body bgcolor=#ffffff>
<h2 align=center>fsync</h2>
<h4 align=center>OS/161 Reference Manual</h4>

<h3>Name</h3>
fsync - flush filesystem data for a specific file to disk

<h3>Library</h3>
Standard C Library (libc, -lc)

<h3>Synopsis</h3>
#include &lt;unistd.h&gt;<br>
<br>
int<br>
fsync(int <em>fd</em>);

<h3>Description</h3>

The fsync function forces a write of dirty filesystem buffers and
other dirty filesystem state associated with the object referred to by
<em>fd</em> to be written to disk.
<p>

fsync should not return until the writes are complete.
<p>

<h3>Return Values</h3>
On success, fsync returns 0. On error, -1 is returned, and
<A HREF=errno.html>errno</A> is set according to the error
encountered.

<h3>Errors</h3>

The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.

<blockquote><table width=90%>
<td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>EBADF</td>		<td><em>fd</em> is not a valid file handle.</td></tr>
<tr><td>EIO</td>		<td>A hard I/O error occurred.</td></tr>
</table></blockquote>

</body>
</html>
